package com.lh.java.basic.datatype;

import com.lh.array.ObjectOrientedArray;
import com.lh.array.exception.EmptyException;
import com.lh.array.exception.FullException;
import com.lh.array.exception.NoElementException;

public class TestObjectOrientedArray {
	public static void main(String[] args) {
		ObjectOrientedArray arr = new ObjectOrientedArray(5);
		System.out.println("arr size="+arr.size());
		try {
			arr.add(5);
			arr.add(7);		
			arr.add(8);
			arr.add(9);
			arr.add(20);
			arr.add(15);	
		} catch (FullException e) {
			System.out.println("数组已满");
		}
		
		System.out.println("now arr size="+arr.size());
		arr.display();
		boolean searchResult = arr.search(23);
		System.out.println("is number exists  "+searchResult);
		try {
			arr.del(88);
		} catch (NoElementException e) {
			System.out.println("无该元素");
		} catch (EmptyException e) {
			System.out.println("数组为空");
		}
		System.out.println("arr size="+arr.size());
		arr.display();
		try {
			arr.del(9);
		} catch (Exception e) {
			System.out.println("删除出问题");
		}
		arr.display();
		System.out.println("arr size="+arr.size());
	}

}
